#include "Stack.h"

#include <iostream>

using namespace std;

Stack::Stack()
{
	top = -1;
	cout<<"stack constructor be called"<<endl;
}

void Stack::push(int value)
{
	top++;
	
	if(top < MAX_STACK) {
		arr[top] = value;
	} else {
		cout<<"Stack full !!!"<<endl;
		top--;
	}
}

int Stack::pop()
{
	if(top == -1) {
		cout<<"stack is empty!!!"<<endl;
		return -1;
	}

	int data = arr[top];
	top--;
	
	return data;
}

Stack::~Stack()
{
	cout<<"stack destructor be called"<<endl;
}
